# 选择基础镜像为 Alpine 3.22 版本上的 Node.js 20.19.2
FROM node:20.19.2-alpine3.22 AS builder

WORKDIR /app
COPY . .
RUN npm i -g pnpm
RUN echo "y" | pnpm i
RUN pnpm build

FROM nginx:1.26.2-alpine3.20 AS runner
COPY conf /etc/nginx/
WORKDIR /usr/share/nginx/html
RUN addgroup --system --gid 1001 web
RUN adduser --system --uid 1001 web
USER web
COPY --from=builder /app/dist .
